package com.mew.chess.core.game.lh.game.common;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 百人牛牛
 */
public enum LhLinkType {

    Prepare(0),  // "准备游戏"),
    Start(1),   // "开始押注"),
    DealCard(2),  // "发牌"),
    Payment(3);  // "赔付");

    private final int code;

    LhLinkType(final int code) {
        this.code = code;
    }

    private final static Map<Integer, LhLinkType> stateMap
            = Arrays.stream(LhLinkType.values()).collect(Collectors.toMap(LhLinkType::code, code -> code));

    public int code() {
        return this.code;
    }


    public static LhLinkType parse(int code) {
        return stateMap.getOrDefault(code, LhLinkType.Start);
    }

}
